package org.itstack.filter;

import org.itstack.BaseOrderLogic;
import org.itstack.model.Order;

/**
 * 地理位置过滤器
 * 根据客户地址判断配送区域
 */
public class LocationFilter extends BaseOrderLogic {
    
    @Override
    public String matterValue(Order order) {
        // 根据客户地址判断配送区域
        String customerAddress = order.getCustomer().getAddress();
        if (customerAddress != null) {
            if (customerAddress.contains("北京")) {
                return "BEIJING";
            } else if (customerAddress.contains("上海")) {
                return "SHANGHAI";
            } else if (customerAddress.contains("广州")) {
                return "GUANGZHOU";
            } else if (customerAddress.contains("深圳")) {
                return "SHENZHEN";
            }
        }
        return "OTHER";
    }
}
